﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Navigation;

namespace Norma43
{
    public partial class Grafic : PhoneApplicationPage
    {
        // Constructor
        public Grafic()
        {
            InitializeComponent();


            // Set the data context of the listbox control to the sample data
            this.Loaded +=new RoutedEventHandler(Grafic_Loaded);
        }

        // Load data for the ViewModel Items
        private void Grafic_Loaded(object sender, RoutedEventArgs e)
        {
            string text = NavigationContext.QueryString["data"];

             if (text == "ingres")
             {
                 PivotData.Header = "per data";
                 PivoAgrupat.Header = "agrupats";
                 this.lbIngData.ItemsSource = App.lstMovimentsIngres;
                 GridIngressos.Visibility = System.Windows.Visibility.Visible;
                 GridDespeses.Visibility = System.Windows.Visibility.Collapsed;
             }
             else
             {
                 PivotData.Header = "per data";
                 PivoAgrupat.Header = "agrupades";
                 this.lbIngData.ItemsSource = App.lstMovimentsDespesa;
                 GridIngressos.Visibility = System.Windows.Visibility.Collapsed;
                 GridDespeses.Visibility = System.Windows.Visibility.Visible;
             }

        }
    }
}